package com.fdb.efp.loan.service.facade;

import com.irdstudio.basic.framework.core.exception.BizException;
import com.irdstudio.basic.framework.core.exception.PauseException;
import com.fdb.efp.loan.service.vo.AccLoanStatisticalInfo;
import com.fdb.efp.loan.service.vo.AccLoanVO;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
 * <p>Description:贷款台账				<p>
 * @author chenqm1
 * @date 2018-05-03
 */
public interface AccLoanService {

	public List<AccLoanVO> queryAllOwner(AccLoanVO accLoanVo);

	public List<AccLoanVO> queryAllCurrOrg(AccLoanVO accLoanVo);

	public List<AccLoanVO> queryAllCurrDownOrg(AccLoanVO accLoanVo);

	public List<AccLoanVO> queryAllCurrOwnerPrd(AccLoanVO accLoanVo);

	public List<AccLoanVO> queryByRscOwner(AccLoanVO accLoanVo);

	public List<AccLoanVO> queryByRscCurrOrg(AccLoanVO accLoanVo);

	public List<AccLoanVO> queryByRscCurrDownOrg(AccLoanVO accLoanVo);

	public int insertAccLoan(AccLoanVO accLoanVo) throws Exception;

	public int deleteByPk(AccLoanVO accLoanVo);

	public int updateByPk(AccLoanVO accLoanVo);

	public AccLoanVO queryByPk(AccLoanVO accLoanVo);

	public int batchUpdate(List<AccLoanVO> list);

	//根据条件查询台账信息
	public AccLoanVO querySigleAccLoanByCondition(AccLoanVO accLoanVo);

	public List<AccLoanVO> queryListByCont(AccLoanVO vo);

	public List<AccLoanVO> queryAllContNo(String contNo);

	public AccLoanVO queryBillNoByLoanAccount(AccLoanVO accLoanVo);

	public List<AccLoanVO> queryListByCusType(String cusType);

	public AccLoanVO queryByManualIdt(AccLoanVO accLoanVo);

	public AccLoanVO queryBySevenResult(AccLoanVO accLoanVo);

	public List<AccLoanVO> queryListByAccStatus(AccLoanVO accLoanVo);

	public List<AccLoanVO> queryOverdueDays(AccLoanVO accLoanVO);

	//未结清合同列表
	public List<String> queryContListByAccStatus();
	//未结清借据列表
	public List<String> queryBillListByAccStatus(AccLoanVO accLoanVO);
	//未结清客户列表
	public List<AccLoanVO> queryCusIdListByAccStatus();
	//业务流转插入台账
	public String insertAccLoanByBizSerno(String bizSerno) throws PauseException;

	//解除风险分类调整审批通过后更新台账表
	public boolean batchUpdateAccLoan(String taskNo) throws PauseException ;

	//按合同发起风险分类调整审批通过后更新台账表
	public boolean batchUpdateAccLoanForAdjustCont(String taskNo) throws PauseException ;

	//按借据发起风险分类调整审批通过后更新台账表
	public boolean batchUpdateAccLoanForAdjustBill(String taskNo) throws PauseException ;

	public List<AccLoanVO> queryAccLoanByContNos(List<String> contNos);
	//根据法人机构号查询 该法人下放款总额度
	public BigDecimal queryLoanBalanceByLegalOrgCode(String legalOrgCode);
	//获取未结清的台帐信息
	public List<AccLoanVO> queryListAll();
	//查询合同第一笔发放贷款的日期
	public AccLoanVO queryByfirstDisbDate(AccLoanVO inVo);

	/**
	 * 条件查询台账列表
	 * @param accLoanVO
	 * @return
	 */
	public List<AccLoanVO> queryAccLoanListByCondition(AccLoanVO accLoanVO);
	//查询是否存在合同未结清的数据
	public List<AccLoanVO> queryListByStatus(List<String> billNoList);
	//查询是否存在逾期的借据
	public List<AccLoanVO> queryListByOvertime(List<String> billNoList);
	/**
	 * 根据借据编号List查借据数据
	 * @param billNos
	 * @return
	 */
	public List<AccLoanVO> queryByBillNos(List<String> billNos);

	/**
	 * 主动催收申请表
	 * @param accLoanVO
	 * @return
	 */
	public List<AccLoanVO> queryColtAutoApp(AccLoanVO accLoanVO);

	public AccLoanVO queryMinByCapOverdueDate(List<String> billNoList);

	public AccLoanVO queryMinByIntOverdueDate(List<String> billNoList);

	public AccLoanVO queryFirstByMaxTimesTotal(List<String> billNoList);

	public AccLoanVO queryFirstBySevenResult(List<String> billNoList);

	//4.12.10	自动生成法务出催提醒
	public List<AccLoanVO> queryLegalForOutWithStatus(List<String> billNos);
	public List<AccLoanVO> queryLegalForOutWithOverTime(List<String> billNos);
	/**
	 * 查询台账所有数据
	 * @return  List<AccLoan>
	 */
	public List<AccLoanVO> queryAllAccLoan();

	/**
	 * 查询产品额度
	 * @param prdCode
	 * @param legalOrgCode
	 * @return
	 */
	public BigDecimal queryPrdBalance(String prdCode, String legalOrgCode);
	//查询合同底下非正常的借据信息（七级分类为次级、可疑、损失）
	public List<AccLoanVO> queryBadResultByContNo(String contNo);

	/**
	 * 统计需要七级分类的借据数据
	 * @return
	 */
	public List<String> queryCusIds4SevenClassify();

	/**
	 * 获取需要七级分类的借据列表数据
	 * @param pageIndex
	 * @param pageSize
	 * @return
	 */
	public List<AccLoanVO> queryAccLoanList4SevenClassifyByCusIds(List<String> cusIds);

	public void batchUpdateAccLoanFromMaTxt();

	public AccLoanVO queryBRR(AccLoanVO accLoanVO);

	 /**
		 *
		 * 日初借据信息临时表数据到借据信息表有数据则更新，无则新增 <br>
		 * 0.1:weijj:2019年5月7日 下午2:37:18:新增 <br>
		 *
		 * @author weijj
		 * @since 2019年5月7日 下午2:37:18
		 * @date 2019年5月7日 下午2:37:18
		 * @version 0.1
		 */
		public int insertOrUpdateAccLoan(List<AccLoanVO> list);

		public BigDecimal queryPreOccAmt(AccLoanVO accLoanVO);

        public BigDecimal queryPreOccAmt2(AccLoanVO accLoanVO);

		public String queryMaxBizdate(Map<String,String> paramMap);


	public List<AccLoanVO> queryPersonlLoanInfo(AccLoanVO accLoanVO);

	/**
	 * 查询符合条件的单个借据信息
	 * @param accLoanVO
	 * @return
	 */

	public AccLoanVO querySinglePersonlLoanInfo(AccLoanVO accLoanVO);

	/**
	 * 开发人员：【chenxuan】
	 * 创建/修改日期：【2019/5/20】
	 * 修改描述：根据还款计划业务日期查询借据信息列表
	 * @Param [openDay]
	 * @return java.util.List<com.irdstudio.efp.loan.service.vo.AccLoanVO>
	 **/

	public List<AccLoanVO> queryLoanInfoBybizDate(String openDay);

	/**
	 * 通过授信申请流水号列表查询借据信息: <br>
	 *
	 * 0.1:caoxin:2019/5/22 19:08: TODO: <br>
	 * @author caoxin
	 * @return
	 * @since 2019/5/22 19:08
	 * @date 2019/5/22 19:08
	 * @version 0.1
	 */

	List<AccLoanVO> queryByApplySqes(List<String> ids);

	/**
	 * 插入或更新借据信息: <br>
	 * 0.1:caoxin:2019/7/10 10:44: 插入或更新借据信息: <br>
	 * @author caoxin
	 * @return
	 * @since 2019/7/10 10:44
	 * @date 2019/7/10 10:44
	 * @version 0.1
	 */

	int insertOrUpdateByPk(AccLoanVO accLoanVO);

	/**
	 * 需求编号:2019D08--
	 * 问题编号:
	 * 开发人员: caoxin
	 * 创建日期:2019/10/9
	 * 功能描述:根据证件号码查询正常为 1,逾期为 10 并且 信息担保 00的贷款余额
	 * 修改日期:2019/10/9
	 * 修改描述:
	 */
	List<AccLoanVO> queryLoanByCertCodeAndStatusAndAssure(String certCode, String certType) throws BizException;



	/**
	 * 问题编号：<br/>
	 * 功能描述：根据证件类型和证件号码查询借据表<br/>
	 * 创建时间：2019年8月19日<br/>
	 * @param accLoanVO
	 * @return
	 */
	public List<AccLoanVO> queryAccLoan(AccLoanVO accLoanVO);

	/**
	 *
	 * 根据流水号查询台账信息
	 *
	 * @author wanglihua
	 * @params  * @param null
	 * @return
	 * @since 2019/11/14 11:25
	 * @date 2019/11/14 11:25
	 * @version 0.1
	 */
	public AccLoanVO queryOneAccLoanData(String applySeq);

    public AccLoanVO queryDbllInfo(String billNo);

    public List<AccLoanVO> batchQuerybyCert(List<String> certTypes,List<String>certCodes);


	List<AccLoanVO> queryByCertCodeAndPrdId(String certCode, String prdId) throws Exception;

	/**
	 * 批次使用
	 *
	 * @author XIEZIWEI
	 * @params  * @param null
	 * @return
	 * @since 2020/4/2 14:41
	 * @date 2020/4/2 14:41
	 * @version 0.1
	 */
	public String queryPrdId(String billNo);

	List<AccLoanStatisticalInfo> queryAccLoanStatisticalInfos(List<String> billNos);

	List<AccLoanVO> queryByCertCode(String certCode) throws Exception;

	int insertOrUpdatePsd(List<AccLoanVO> list) throws Exception;

	int batchInsert(List<AccLoanVO> list) throws Exception;

	boolean isCusLossCredit(String cusId);

	int insertOrUpdateYed(List<AccLoanVO> list) throws Exception;

	/*
	 * 根据借据号查询贷款号和发放号
	 *
	 */
	public AccLoanVO queryLSAndDNByPK(String billNo);
    /*查询某个人在网贷是否逾期过 */
    public AccLoanVO queryOverdue(String certType,String certCode) throws Exception;

    public List<AccLoanVO> queryByCertandPrd(AccLoanVO accLoanVO);

    /*根据产品编号身份证分页查询*/
	public List<AccLoanVO> queryByCertAndPrdByPage(AccLoanVO accLoanVO);

    public AccLoanVO queryByPrdIdAndApplySeq(AccLoanVO accLoanVo) ;

	public AccLoanVO queryByApplySeq(AccLoanVO accLoanVo) ;

	/**
	 * 查询客户下所有借据的最早还款日期
	 * @param inVo
	 * @return
	 */
	public AccLoanVO queryfirstDisbDateByCond(AccLoanVO inVo);

}
